<?php 
error_reporting(E_ALL); 

$name = $_POST['name']; 
$mail= $_POST['mail']; 
$message = $_POST['message']; 

/*
$header = 'From: ' . $mail . "\r\n"; 
$header .= "X-Mailer: PHP/" . phpversion() . " \r\n"; 
$header .= "Mime-Version: 1.0 \r\n"; 
$header .= "Content-Type: text/plain"; 
*/
$mensaje = "Name: " . $name . " \r\n"; 
$mensaje .= "E-Mail: " . $mail . " \r\n"; 
$mensaje .= "Message: " . $message . " \r\n"; 
$mensaje .= "Sent: " . date('d/m/Y H:i', time()); 

//$para = 'info@sportsballworld.com'; 
$source = 'info@etwirl.com';
$para = 'jedell@sportsballworld.com'; 
$asunto = $name." - ".$mail; 

//mail($para, $asunto, utf8_decode($mensaje), $header); 

// AWS SES
require_once '../../sdk-1.5.14/sdk.class.php';

$ses = new AmazonSES(array('key'=>'AKIAII7LHYM4KWGKGQLQ', 'secret'=>'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'));

$rSendEmail = $ses->send_email($source,
      array('ToAddresses' => array($para), 'CcAddresses'=>array('info@etwirl.com')),
           array(
                'Subject.Data' => $asunto,
                'Body.Text.Data' => $mensaje,
           )
 );

/*
$destination = CFComplexType::map(array('ToAddresses'=>$para));
$messageArr = CFComplexType::map(array('Subject.Data'=>$asunto, 'Body.Text.Data'=>$message));

$rSendEmail = $ses->send_email($source, $destination, $messageArr);

if ($rSendEmail->status==200) {
	$emailId = $rSendEmail->body->SendEmailResult->MessageId;
	echo("sent test email with id: $emailId\n");
}
else {
	print_r($rSendEmail);
}
*/

header('Location: http://www.sportsballworld.com/');
?> 